var t = require;
var e = module;
var o = exports;
var a,
    i =
        (this && this.__extends) ||
        ((a = function (t, e) {
            return (a =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                })(t, e);
        }),
        function (t, e) {
            a(t, e);
            function o() {
                this.constructor = t;
            }
            t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o());
        }),
    n =
        (this && this.__decorate) ||
        function (t, e, o, a) {
            var i,
                n = arguments.length,
                r = n < 3 ? e : null === a ? (a = Object.getOwnPropertyDescriptor(e, o)) : a;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, a);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (i = t[s]) && (r = (n < 3 ? i(r) : n > 3 ? i(e, o, r) : i(e, o)) || r);
            return n > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var r = t("UIBase"),
    s = t("UIConfig"),
    c = t("UIManager"),
    p = t("ZhuanPanRewardBean"),
    l = t("CommonRandom"),
    d = cc._decorator,
    u = d.ccclass,
    h =
        (d.property,
        d.menu,
        (function (t) {
            i(e, t);
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                e.startAngle = 0;
                e.isPlaying = !1;
                e.canUpdataReward = !0;
                e.moveDis = 350;
                e.rewardData = {};
                e.rewardBean = new p.default();
                e.recNode = [];
                e.playTime = 3;
                e.randCom = new l.default();
                e.playDir = 1;
                e.rewardKindId = [0, 1, 2, 3, 4, 5, 6, 7];
                e.minCount = 5;
                e.checkAd = !0;
                e.isViewAd = !0;
                e.maxminutelimite = 60;
                e.systimelimite = 1e3;
                e.timeSep = ":";
                return e;
            }
            e.prototype.onShowEnd = function () {
                if (this.ui_data.adView) {
                    this.isViewAd = !1;
                    this._adNode.active = !1;
                } else this._adNode.active = !0;
                this.setViewData();
                PlayEffectDo.playItemScaleIn(this._scaleNode, 0.4, 0.1);
                PlayEffectDo.playItemScaleIn(this._play, 0.4, 0.1);
                this._font.active = !1;
            };
            e.prototype.onCloseStart = function () {
                for (var t = 0; t < this.recNode.length; t++) QLooperNode.putNode(this.recNode[t]);
            };
            e.prototype.setViewData = function () {};
            e.prototype._onPlayTouchEnd = function () {};
            e.prototype.update = function () {
                this.checkAd;
            };
            e.prototype.getFormat = function (t) {
                return (
                    this.getFont(Math.floor(t / this.maxminutelimite)) +
                    this.timeSep +
                    this.getFont(t % this.maxminutelimite)
                );
            };
            e.prototype.getFont = function (t) {
                return 0 == t ? "00" : 1 == (t + "").length ? "0" + t : t + "";
            };
            e.prototype.overCallReward = function (t) {
                var e = this.rewardData[t];
                c.default.open(s.UIID.UIRewardZhuanPan, {id: e.id, count: e.count});
                this.closeUI();
                this._font.active = !1;
            };
            e.prototype.resetRewardDataView = function () {
                this.canUpdataReward && (this.canUpdataReward = !1);
            };
            e.prototype.startNextPlay = function () {
                if (!this.isPlaying) {
                    this._font.active = !0;
                    this.checkAd = !0;
                    this.isPlaying = !0;
                    this.resetRewardDataView();
                    var t = this.getRandIndex();
                    this.resetAngle();
                    var e = t;
                    this.playIndex(t, e);
                }
            };
            e.prototype.getRandIndex = function () {
                return this.randCom.getRandomIndex();
            };
            e.prototype.resetAngle = function () {
                this.rotNode().angle = this.startAngle;
            };
            e.prototype.playIndex = function (t, e) {
                var o = this,
                    a = 360 / this.rewardKindId.length,
                    i = 360 * this.minCount + t * a,
                    n = 0,
                    r = 0,
                    s = 360 / this.rewardKindId.length;
                this.rotNode().runAction(
                    cc.sequence([
                        cc
                            .rotateBy(this.playTime, this.playDir * i)
                            .easing(cc.easeInOut(2))
                            .easing({
                                easing: function (t) {
                                    n = Math.floor(Math.abs(o.rotNode().angle / s)) * s;
                                    r != n && (r = n);
                                    return t;
                                }
                            }),
                        cc.delayTime(1),
                        cc.callFunc(function () {
                            o.isPlaying = !1;
                            o.canUpdataReward = !0;
                            o.overCallReward(e);
                        }, this)
                    ])
                );
            };
            e.prototype.rotNode = function () {
                return this._rotate;
            };
            return n([u], e);
        })(r.default));
o.default = h;
